/**
 * 
 */
package com.gragra.sampling.vector;
import java.util.Arrays;
import com.gragra.data.MixingCorpus;
import com.gragra.sampling.assignerFactories.VectorAssignerFactory;
/**
 * @author Christoph Teichmann
 * created Apr 29, 2013 10:22:58 PM
 * @version 0.1
 */
public class BinaryStackedClassesUnitCRPFactory implements
		VectorAssignerFactory
{
	/**
	 * creates a new instance of the class with the double value giving the base measure for the CRP used in every
	 * unit of the Assigners it will create and all the assigner using the same number of levels
	 * @param unitConcentration
	 * @param numbersOfLevels
	 */
	public BinaryStackedClassesUnitCRPFactory(double unitConcentration, double labelConcentration,int numberOfTags, int threads)
	{
		this.unitConcentration = unitConcentration;
		this.labelConcentration = labelConcentration;
		this.numberOfTags = numberOfTags;
		this.threads = threads;
	}
	/**
	 * 
	 */
	private final int threads;
	/**
	 * 
	 */
	private final double unitConcentration;
	/**
	 * 
	 */
	private final double labelConcentration;
	/**
	 * 
	 */
	private final int numberOfTags;
	/* (non-Javadoc)
	 * @see com.gragra.sampling.assignerFactories.VectorAssignerFactory#createNewInstance(com.gragra.data.MixingCorpus)
	 */
	@Override
	public VectorProbabilityAssigner createNewInstance(
			MixingCorpus<? extends VectorStructure> corpus)
	{
		int units = LimitedClassesUnitCRPFactory.getMaxUnit(corpus);
		double[] concentrations = new double[units+1];
		Arrays.fill(concentrations, unitConcentration);
		return new BinaryStackedClassesUnitCRP(numberOfTags, concentrations, this.labelConcentration, this.threads);
	}
}